﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WInSPen.BaseClass;
using WinSPen.Settings;

namespace WinSPen.ViewModels
{
    internal class WSPStrokeModeButtonViewModel : ViewModelBase
    {
        private string _strCurrentPenType = "Pen";

        public string StrCurrentPenType
        {
            get { return _strCurrentPenType; }
            set { _strCurrentPenType = GetCurrentPenType(StrokeSetting.GetInstance().CurrentPenType); OnPropertyChanged("StrCurrentPenType"); }
        }

        private string GetCurrentPenType(PenType penType)
        {
            switch (penType)
            {
                case PenType.Pen:
                    return "Pen";
                case PenType.Brush:
                    return "Brush";
                case PenType.Brush2:
                    return "Brush2";
                case PenType.Pencil:
                    return "Pencil";
                case PenType.Marker:
                    return "Marker";
                default:
                    return "Pen";
            }
        }

        private RelayCommand _cmdChangeToStrokeMode;

        public RelayCommand CmdChangeToStrokeMode
        {
            get
            {
                if (_cmdChangeToStrokeMode == null)
                {
                    _cmdChangeToStrokeMode = new RelayCommand(param => ChangeToStrokeMode());
                }
                return _cmdChangeToStrokeMode;
            }
        }

        private void ChangeToStrokeMode()
        {
            if (ModeSetting.GetInstance().DrawMode == DrawingMode.StrokeMode)
            {
                // TODO: 한번 더 눌렀으니 세팅창을 불러옴
            }
            else
            {
                // 다른 모드였으므로 스트로크 모드로 변경
                if (ModeSetting.GetInstance().DrawMode == DrawingMode.TextMode)
                {
                    // TODO: TextMode 버튼 disable
                }
                else if (ModeSetting.GetInstance().DrawMode == DrawingMode.EraserMode)
                {
                    // TODO: EraserMode 버튼 disable
                }

                ModeSetting.GetInstance().DrawMode = DrawingMode.StrokeMode;
            }
        }
    }
}
